var newboardvideoCheckedItems;
var data_data;
function getnewboardvideoData() {
    
    
    
	var startDate = $("#newboardvideoStartDate").val();
	var endDate = $("#newboardvideoEndDate").val();
    
    
    
   

	$(".newboardvideoChart").html("");
	if (startDate != "" && endDate != "")
	{
		var start = new Date();
		var end = new Date();

		//统计项
		var items = document.getElementsByName("newboardvideoCheckbox");
		newboardvideoCheckedItems = new Array();
		for(var i=0;i<items.length;i++) {
			if (items[i].checked)
			{
				newboardvideoCheckedItems.push(items[i].value);
			}
		}

		if(newboardvideoCheckedItems.length > 0) {


			jQuery('#body-wrapper').showLoading();
			start.setFullYear(startDate.substring(0,4), startDate.substring(5,7)-1, startDate.substring(8,10));
			end.setFullYear(endDate.substring(0,4), endDate.substring(5,7)-1 ,endDate.substring(8,10));

			days = parseInt((end - start)/1000/60/60/24)+1;

			var APIurl = "/client/newboardvideo?staDate="+startDate+"&pd="+days;
	        
            
            

			
			$.ajax({
				type: "GET",
				url: APIurl,
				dataType : "json",
				jsonnp: "callback",
				success:function(data,textStatus){ loadnewboardvideoData(data)}
			});
		}
		else {
			alert("请选择至少一个统计项");
		}

	}
	else {
		alert("请选择时间区域");
	}
}


var newboardvideoTabArr, newboardvideoDetailArr, newboardvideoSumArr, newboardvideoDateArr, MainSubTitle;
function loadnewboardvideoData(data) {
    
   
    
    data_data = data;
	var tab = "";
	var startDate = $("#newboardvideoStartDate").val();
	var endDate = $("#newboardvideoEndDate").val();
	MainSubTitle = startDate.replace(/\//g, "-") + " 至 " + endDate.replace(/\//g, "-");
	jQuery('#body-wrapper').hideLoading();	


	newboardvideoTabArr = new Array();
	newboardvideoDetailArr = new Array();
	newboardvideoSumArr = new Array();
	newboardvideoDateArr = new Array();
    
    

            genTabsnewboardvideo("newboardvideo");
            
            //读取数据
            
        if ($("#newboardvideoPieTab").hasClass("selbitem")){
            
			changeChartType('newboardvideo', 'Pie');
        }
        
        if ($("#newboardvideoTableTab").hasClass("selbitem")){
            
			changeChartType('newboardvideo','Table');
        }
        
        if (!$("#newboardvideoTableTab").hasClass("selbitem") && !$("#newboardvideoPieTab").hasClass("selbitem")){
            
			changeChartType('newboardvideo','Pie');
        }
        
        
        
        //生成表格
        genTop10Tablenewboard("newboardvideoTable",data['Phone']['table1'],data['Phone']['table2'],data['Phone']['table3']);
        
        //生成线图
        genSummaryLineChart_newboard("newboardvideoPie","Phone排名趋势图",data['Phone']['xianx'],data['Phone']['xiany'],data['Phone']['xianm']);
        
    
	
}

function changenewboardvideoTab(tabName,optionName) {
	
        
    
        //生成表格
        genTop10Tablenewboard("newboardvideoTable",data_data[tabName]['table1'],data_data[tabName]['table2'],data_data[tabName]['table3']);
        
        title1 = tabName + "排名趋势图"; 
        
        
        
        //生成线图
        genSummaryLineChart_newboard("newboardvideoPie",title1,data_data[tabName]['xianx'],data_data[tabName]['xiany'],data_data[tabName]['xianm']);
    
    
    
	//$(".bitem").removeClass("selbitem");
    $("#newboardvideoTabPhone").removeClass("selbitem");
    $("#newboardvideoTabPad").removeClass("selbitem");
	$("#newboardvideoTab"+tabName).addClass("selbitem");	
    
    
    
	
}

function changenewboardvideoTableTabcc(cc){
    
    
    $("#newboardvideoTableTab1").removeClass("selbitem");
    $("#newboardvideoTableTab2").removeClass("selbitem");
    $("#newboardvideoTableTab"+cc).addClass("selbitem");
    
    
    $("#newboardvideoTableX1").hide();
    $("#newboardvideoTableX2").hide();
    
    $("#newboardvideoTableX"+cc).show();

}



